iRepeat = int(input())
lst_order = input().split()
sPre = 'S'
lst = []
dic = {}
#1.先把撲克牌list建好
for i in range (4):
if i ==1:
sPre = 'H'
elif i == 2:
sPre = 'C'
elif i ==3:
sPre = 'D'
for j in range(1,14):
lst.append(sPre + str(j))
lst.append('J1')
lst.append('J2')
#print(lst)
'''
重複次數
'''
for n in range(iRepeat):
iIndex = 0
for i in lst_order:
#2.將order與卡牌關係放進dictionary[2]=S3
dic[int(i)] = lst[iIndex]#dict[int] 跟 dict[str]不同
iIndex +=1
for j in range(54):
#3.照順序1~54將dictionary[]的值放進list
lst[j] = dic[j+1]
#print(lst)
sRtn = ""
for i in lst:
sRtn += (i + " ")
print(sRtn.rstrip())
iRepeat = int(input())
lst_order = input().split()
lst_s = ['S','H','C','D']
lst = []
dic = {}
#1.先把撲克牌list建好
for i in range (4):
sPre = lst_s[i]
for j in range(1,14):
lst.append(sPre + str(j))
lst.append('J1')
lst.append('J2')
#print(lst)
'''
重複次數
'''
for n in range(iRepeat):
iIndex = 0
#2.將order與卡牌關係放進dictionary[2]=S3
for i in lst_order:
dic[int(i)] = lst[iIndex] #dict[int] 跟 dict[str]不同
iIndex +=1
#3.照順序1~54將dictionary[]的值放進list
for j in range(len(lst)):
lst[j] = dic[j+1]
print(' '.join(lst))
本文純自己做題目之筆記,如有更好的方法再麻煩各位指教~~